API Documentation
Public Member Functions | List of all members
nkWinUi::ComponentManager Class Referencefinal

Manages the components within nkWinUi. More...

Inheritance diagram for nkWinUi::ComponentManager:

Public Member Functions

ComponentcreateOrRetrieve (const std::string_view &name, COMPONENT_TYPE componentType)
 
Componentget (const std::string_view &name) const
 
ComponentgetByIndex (unsigned int index) const
 
void erase (const std::string_view &name)
 

Detailed Description

Manages the components within nkWinUi.

Responsible for creating and book-keeping them. At all time, the manager is responsible for the memory allocated inside it.

Member Function Documentation

◆ createOrRetrieve()

Component* nkWinUi::ComponentManager::createOrRetrieve ( const std::string_view &  name,
COMPONENT_TYPE  componentType 
)

Creates (if unavailable) or retrieves (if available) component attached to passed name.

Parameters
nameThe name, aka identifier, of the component to create or retrieve.
componentTypeThe type the component should be.
Returns
The component attached to passed name. The Manager is the owner of the memory returned.

◆ get()

Component* nkWinUi::ComponentManager::get ( const std::string_view &  name) const

Returns a component attached to a name, if available.

Parameters
nameThe name of the component that should be retrieved.
Returns
The component if existing, nullptr else.

◆ getByIndex()

Component* nkWinUi::ComponentManager::getByIndex ( unsigned int  index) const

Returns the component at given index, if available.

Parameters
indexThe index of the component to retrieve.
Returns
The component attached to given index.
Remarks
An index refers to the index in the manager's container, so one index can be attached through different components depending on allocations. This method is meant to loop on all components in one go, because of this.

◆ erase()

void nkWinUi::ComponentManager::erase ( const std::string_view &  name)

Erases a component. Memory attached to it will be freed.

Parameters
nameThe name identifying the component to erase.

The documentation for this class was generated from the following file: